Repository navigation
atlas(search): span-filter full-content payloads per sibling chunk (#12624) - #12630
Conversation
…12624) --with-message and hydration payloads carry the whole message text, which spans every chunk of the message; #12404 gated them on the served chunk's classification, so a higher-classified sibling chunk's text could ride along under fleet-internal, hosted-per-user, and local-owner contexts. span_filter_payload (search.rs) now classifies every chunk of the payload's message from its detail row and applies the same grant-intersect-context test the disclosure pass applies to candidates: a failing chunk's text is omitted at every occurrence in the served text (excluded_personal_life spans therefore never cross, in any context), withholding is counted in the envelope notes, and a failing chunk whose text cannot be located in the message text withholds the payload whole (design section 4: an output that cannot be safely filtered is withheld). Text belonging to no chunk rides on the served chunk's gate, as #12404 established. New SearchBackend::message_chunks enumerates a message's chunks (windowless SQL in the local and Turso backends; a wide-window neighbors default for wrappers and stubs). Corpus measurement recorded on #12624: zero mixed- classification messages in the publish corpus today, so this is a guard for per-embed classification (#12408) divergence, not a live-leak fix. Leak tests fail before / pass after; atlas-core, atlas-proto, atlas-search suites green.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 48 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a04a3d321a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let start = from + off; | ||
| ranges.push((start, start + c.text.len())); | ||
| found = true; | ||
| from = start + 1; |
There was a problem hiding this comment.
Advance the span scan along UTF-8 character boundaries
When a withheld sibling's text starts with a multibyte character (for example, ésecret), advancing to start + 1 places from inside that character. The next evaluation of full_text[from..] panics instead of returning a filtered payload, so valid Unicode messages can crash searches using either --with-message or hydration. Advance to the next character boundary while preserving overlapping-match detection, and add Unicode property coverage for this boundary-safety invariant; the added ASCII-only examples do not exercise it.
AGENTS.md reference: AGENTS.md:L37-L39
Useful? React with 👍 / 👎.
Closes the implementation scope of #12624 (the #12404 residual): full-content payloads (
--with-message, hydration) are now filtered at span granularity. Not merging without review — the filter code is the review surface, as with #12404.Mechanism
span_filter_payloadincrates/atlas-core/src/search.rsruns at render time for every full-content payload under the non-public contexts (public-surface still withholds these payloads outright, per #12404). Every chunk of the payload's message is classified from its detail row and tested with the same grant ∩ context intersection the disclosure pass applies to candidates (DisclosureContext::permits_with_grantoverchunk_classification). A chunk that fails has its text treated as a withheld span: every occurrence of that text in the message text is omitted from the served text. A chunk with no detail row fails closed, matchingneighbor_map's rule. Withholding is tallied per search (SpanRecord) and recorded in the envelope notes in the #12404 idiom (disclosure: context … withheld N message span(s) …).Two deliberate edges:
messagereads as null,hydratedis omitted — per design §4's rule for outputs that cannot be safely filtered, and counted in the notes as such.span_filter_payloaddoc comment.Withheld-span shape
Omission. No redaction-marker idiom exists anywhere in atlas or fleet-search; the codebase's withholding idiom is omission plus a count on the record (withheld candidates, withheld neighbors, withheld payloads in #12404). Spans follow it: the span's text is removed, the surroundings stand, and the envelope notes carry the count.
Seam
New
SearchBackend::message_chunksenumerates a message's chunks: windowlessMESSAGE_CHUNKS_SQLoverrides in the local and Turso backends, a wide-windowneighborsdefault (MESSAGE_CHUNKS_WINDOW, chunk_idx units; publish-corpus span measured 0..=1730) for wrappers and test stubs, explicit forwarding inBox<T>. The shard fan-out inherits correct routing through its ownneighbors. No new dependencies.Measurement (acceptance item 1, also recorded on #12624)
Publish corpus (
atlas-publish-v2-2026-10-31.db, the Turso publish source; laptop, read-only SQL, 2026-11-22): 107,639 chunks over 71,551 messages with chunks (6,044 multi-chunk, max 1,731 chunks in one message). Every chunk carries a non-empty sensitivity (personal99,926 /local-only6,941 /secret-bearing772; noshareable, noexcluded_personal_life). Mixed-classification messages: 0 — per-chunk sensitivity is uniform within every message, and no message straddles any context ceiling. So there is no live leak today; this lands the guard before per-embed classification (#12408) can diverge inside a message. A companion probe (300 sampled multi-chunk messages) verified chunk texts occur verbatim in the message text, findable in chunk order, in 300/300 — the property span location relies on.Leak evidence (venue: sandbox)
Fail-before at base
f026268cb(the #12626 merge), new tests incrates/atlas-core/tests/disclosure.rsover a stub whose message mixes shareable / personal / secret-bearing / excluded chunks: 5 failed, all by leaking — the full payload, including the secret-bearing span (the vault code is 493812) and the excluded span, crossed under fleet-internal, hosted-per-user, and local-owner; the unfilterable payload was served whole. The 13 pre-existing #12404 tests passed.Pass-after: disclosure suite 18/18 (incl. the served chunk's own text and admitted sibling spans still crossing — no over-withholding — and the excluded span withheld even for the owner while the secret-bearing span crosses); full
cargo test -p atlas-core -p atlas-proto -p atlas-searchgreen (exit 0);cargo check --workspace --all-targetsclean;cargo fmt --checkclean; no new clippy warnings (one collapsible-if in this diff was collapsed via a let-chain).One stub change in the pre-existing tests:
LeakBackend's m1 message text is now composed of its chunks' texts (the real corpus shape the span filter locates spans in); the #12404 test's assertions are unchanged in the public half and strengthened in the fleet half (payload present, secret span now asserted omitted, personal span asserted present).What remains on #12624
Nothing in the issue's acceptance list: measurement recorded, leak test + chosen rule (span-level filtering) implemented and documented in
search.rs, excluded spans barred under every context, suites green. Out of scope here, as it was for #12404: the shard path's tier content-store hydration (#6664) builds payloads outsidesearch.rs; if it should span-filter too, that is a follow-up on the shard hydration path, not this boundary.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.